//获取应用实例
let app = getApp();
let httptool = require("../../utils/zry.httptool.js");
var tabjs = require("../../utils/tab.js");
Page({
  data: {
    customer: {},
    authTokenRegister:true,//是否注册
    activeIndex:'3',
    msgprop:'',//消息提示 
    tabNum:0,
  },
  //事件点击处理函数
  bindConfigTap: function() {
    wx.navigateTo({
      url: 'config/config'
    })
  },
  bindMsg:function(){
    wx.navigateTo({
      url: 'msgcenter/msgcenter'
    })
  },
    
  /*页面链接跳转*/
  registerBtn:function(e){
    wx.navigateTo({
      url: '/pages/register/register',
    })
  },
  daLei:function(e){
    httptool.login(function () {
      tabjs.daleiBtnClick();
    });  
  }, 
  leiCircle:function(e){
    wx.redirectTo({
      url: '/pages/index/index',
    })
  },
  userLevel:function(){
      wx.navigateTo({
        url: 'userlevel/userlevel',
      })
  },
  mycircles:function(){
      wx.navigateTo({
        url: 'mycircles/mycircles',
      })
  },
  getUserInfos:function(){/*个人信息*/
      let that=this;
      wx.navigateTo({
        url: 'personInfo/personInfo',
      });

  },
  enterComment:function(){//我的评论
      wx.navigateTo({
        url: 'mycomment/mycomment',
      })
  },
  enterConcerns:function(e){//我的关注 ，我的粉丝
    let id=e.currentTarget.dataset.id;
      wx.navigateTo({
        url: '../myfollow/myfollow?ID='+id,
      })
  },
  getScore:function(){//成绩统计
      wx.navigateTo({
        url: '/pages/myCenter/scores/score',
      })
  },
  getHistory:function(){//历史数据
    wx.navigateTo({
        url: '/pages/myCenter/hisrecord/hisrecord',
      })
  },
  deviceManage:function(){//设备管理
      wx.navigateTo({
        url: '/pages/myCenter/device/device',
      })
  },
  getDevice:function(){//我的设备
      wx.navigateTo({
        url: '/pages/myCenter/mydevice/mydevice',
      })
  },
  getLeimeng:function(){//擂盟审核
      wx.navigateTo({
        url: '/pages/myCenter/applyCircle/applycircle',
      })
  },
  friendDetail:function(e){//点击头像进入某人的详情页，查看对方信息，帖子
    let that=this;
    let ToUserId=e.currentTarget.dataset.userid;
    wx.navigateTo({
      url: '../followdetail/followdetail?ToUserId='+ToUserId,
    });
  },
  onLoad: function (options) {   
    // let that=this;
    // let authTokenRegister=wx.getStorageSync("authToken");
    // if(authTokenRegister!='' && authTokenRegister!=null && authTokenRegister!=undefined){
    //     that.setData({authTokenRegister:true}); 
    // }else{
    //   that.setData({authTokenRegister:false}); 
    // }

  },
  onShow:function(){
    let that = this;
    httptool.login(function () {
      let customerId = app.getStorage('customerId');
      httptool.ajaxPost("api/Customer/GetMyInfo", { UserId: customerId }, function (res) {
        if (res.suc) {
          let data = app.notNull(res.data, []);
          that.setData({ customer: data });
        } else {
            app.showNotify(that, res.msg);
        }
      });
    });
  }
})
